package Day017_缓冲流_转换流_序列化流_打印流.demo4_序列流.Test5_序列化集合;

import java.io.Serializable;

/**
 * @author zhangyan
 * @date 2020/5/9 14:43
 */
class Student implements Serializable {
    //class文件在序列化对象之后发生了修改，那么反序列化操作也会失败
    //解决办法: 给一个固定的版本号
    static final long SerialVersionUID = 123456L;

    String name;
    int age; //表明瞬态,不被序列化
    //String sex;

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}